<!DOCTYPE html>
<html>
<head>
    <title>String Type Location Methods Example</title>
    <script type="text/javascript">
    
        var stringValue = "hello world";
        alert(stringValue.indexOf("o"));         //4
        alert(stringValue.lastIndexOf("o"));     //7
        alert(stringValue.indexOf("o", 6));         //7
        alert(stringValue.lastIndexOf("o", 6));     //4                
        
    </script>
</head>
<body>

</body>
</html>